<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Title</title>
  </head>
  
  <body>
    <input type="button" value="发送请求" onclick="sendReq(new Blob(['hello world'], {type: 'text/plain'}))">
  </body>
  
  <script>
    function sendReq(data) {
      const xhr = new XMLHttpRequest();
      
      xhr.upload.onprogress = (e) => {
        if (e.lengthComputable) {
          console.log('上传进度', (e.loaded / e.total) * 100 + '%'); // 100%
        }
      };
      
      xhr.open('POST', 'http://localhost:9000/back_end_post/params');
      xhr.send(data);
    }
  </script>
</html>